//#pragma comment(lib, "comctl32.lib")

#include <windows.h>
#include <commctrl.h>		// INCLUDE LIBRARY comctl32.lib INTO YOUR PROJECT!
//#include "resource.h"		// UNCOMMENT THIS IF YOU USE RESOURCES.

// names of window classes.
#define WND_CLASS_NAME0 "my_wnd_class_name_0"

// identifiers.
#define IDC_COMBO0    2000
#define IDC_LISTVIEW0 2001
#define IDC_STATUS0   2002
#define IDC_GROUP0    2003

// function prototypes.
void register_classes();
int message_loop();
HWND create_wnd0();
void create_wnd_content0(HWND parent);
LRESULT CALLBACK wnd_proc0(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);

// global data.
HINSTANCE instance;
HFONT h_font;

// main function.
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinst, LPSTR cmdline, int show)
{
	instance = hinstance;
//	InitCommonControls();
	register_classes();
	h_font = CreateFont(-13, 0, 0, 0, FW_NORMAL, 0,
				0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
				DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Times New Roman");
	create_wnd0();
	return message_loop();
}

// window procedure #0 [ReactOS Search].
LRESULT CALLBACK wnd_proc0(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
	switch (msg)
	{
	case WM_CREATE:
		create_wnd_content0(hwnd);
		break;

	case WM_CLOSE:
		if (IDYES == MessageBox(hwnd, "Quit?", "Event", MB_YESNO|MB_ICONQUESTION)) DestroyWindow(hwnd);
		break;

	case WM_DESTROY:
		PostQuitMessage(0);	// PostQuitMessage(return_code) quits the message loop.
		break;

	default:
		return DefWindowProc(hwnd, msg, wparam, lparam);
	}
	return FALSE;
}

// create window #0 [ReactOS Search].
HWND create_wnd0()
{
	HWND wnd;
	wnd = CreateWindowEx(0x00000100, WND_CLASS_NAME0, "ReactOS Search", 0x14CF0000, CW_USEDEFAULT, CW_USEDEFAULT, 773, 496, NULL, NULL, instance, NULL);
	ShowWindow(wnd, SW_SHOWNORMAL);
	UpdateWindow(wnd);
	return wnd;
}

// create window content #0 [ReactOS Search].
void create_wnd_content0(HWND parent)
{
	HWND wnd;
	wnd = CreateWindowEx(0x00000000, "Button", "Search Box\r\n\r\n", 0x50020007, 0, 0, 736, 88, parent, (HMENU) IDC_GROUP0, instance, NULL);
	SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
	wnd = CreateWindowEx(0x00000000, "msctls_statusbar32", "", 0x50000000, 0, 435, 757, 23, parent, (HMENU) IDC_STATUS0, instance, NULL);
	SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
	wnd = CreateWindowEx(0x00004200, "SysListView32", "", 0x50010000, 0, 88, 736, 344, parent, (HMENU) IDC_LISTVIEW0, instance, NULL);
	SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
	wnd = CreateWindowEx(0x00000000, "ComboBox", "", 0x50010203, 143, 41, 96, 23, parent, (HMENU) IDC_COMBO0, instance, NULL);
	SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
}

// register all the window classes.
void register_classes()
{
	WNDCLASS wc;

	wc.cbClsExtra    = 0;
	wc.cbWndExtra    = 0;
	wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
	wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
	wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
	wc.hInstance     = instance;
	wc.lpszMenuName  = NULL;
	wc.style         = CS_PARENTDC | CS_DBLCLKS;

	wc.lpfnWndProc   = wnd_proc0;
	wc.lpszClassName = WND_CLASS_NAME0;

	RegisterClass(&wc);
}

// message loop.
int message_loop()
{
	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	DeleteObject(h_font);
	return msg.wParam;
}

/* End of file */
